/**
 *
 * Escola
 * 19/05/2012 - 16:21:13
 *
 */
package escola.logic.impl;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import escola.dao.AbstractDAO;
import escola.logic.Logic;

/**
 * @author Jonathan
 *
 */
public abstract class AbstractImpl<T> implements Logic<T>{

	@Override
	public T save(T entity) {
		return getDAO().save(entity);
	}

	@Override
	public Collection<T> saveAll(Collection<T> entities) {
		return getDAO().saveAll(entities);
	}

	@Override
	public T getById(Integer id) {
		return getDAO().getById(id);
	}

	@Override
	public Set<T> getByIds(int[] ids) {
		return getDAO().getByIds(ids);
	}

	@Override
	public Set<T> getByIds(Integer[] ids) {
		return getDAO().getByIds(ids);
	}

	@Override
	public Set<T> getByIds(Collection<Integer> ids) {
		return getDAO().getByIds(ids);
	}

	@Override
	public List<T> getAll() {
		return getDAO().getAll();
	}

	@Override
	public T getByParam(String field, Object param) {
		return getDAO().getByParam(field, param);
	}

	@Override
	public List<T> getByParamLike(String fiel, String param) {
		return getByParamLike(fiel, param);
	}

	@Override
	public void deleteAll(Collection<T> entities) {
		getDAO().deleteAll(entities);
	}

	@Override
	public void delete(T entity) {
		getDAO().delete(entity);
	}

	@Override
	public void delete(Integer id) {
		getDAO().delete(id);
	}

	protected abstract AbstractDAO<T> getDAO(); 

}
